export const storage = {
  set(key, data) {
    try {
      uni.setStorageSync(key, data);
      return true;
    } catch (e) {
      console.warn(e);
      return false;
    }
  },
  get(key) {
    try {
      const res = uni.getStorageSync(key);
      if (res) return res;
      // console.warn(`Failed to get storage, key of ${key} does not exist`)
    } catch (e) {
      console.warn(e);
    }
  },
  remove(key) {
    try {
      uni.removeStorageSync(key);
      return true;
    } catch (e) {
      console.warn(e);
      return false;
    }
  },
  clear() {
    try {
      uni.clearStorageSync();
      return true;
    } catch (e) {
      console.warn(e);
      return false;
    }
  },
};
